<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>我的积分</title>

    <meta name="viewport" id="mobileViewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="Expires" content="-1">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Pragma" content="no-cache">
    <meta name="description" content="！">
    <meta name="Keywords" content="">

    <link rel="stylesheet" href="${contextPath}/staticwx/hx/css/reset.css">
    <link rel="stylesheet" href="${contextPath}/staticwx/hx/css/global.css">
    <link rel="stylesheet" href="${contextPath}/staticwx/hx/css/iconfont.css">
    <link rel="stylesheet" href="${contextPath}/staticwx/hx/css/flex.css">
    <link rel="stylesheet" href="${contextPath}/staticwx/hx/css/uc.css">
    <link rel="stylesheet" href="${contextPath}/staticwx/hx/css/dropload.css">
</head>
<body>
<form id="searchForm"  method="post">
    <div class="wrapper">
        <header class="header">
            <div class="hl" onclick="javascript:window.history.go(-1);"><span class="iconfont icon-fanhui"></span></div>
            <div class="hc">我的积分</div>
            <div class="hr"><span class="iconfont icon-zhuye" onclick="javascript:location.href='${contextPath}/staticwx/index.htm'"></span></div>
        </header>
        <div class="jifenTop">
            <img src="${contextPath}/staticwx/hx/images/jf1.jpg">
            <p class="p1">您当前积分为：</p>
            <div class="jifen" flex="cross:center main:center">
                <p class="p2">${account.integral!0}分</p>
            </div>
        </div>
        <div class="space"></div>
        <div class="titPub">
            <p>积分明细</p>
        </div>
        <ul class="jifenList">
            <#list page as item>
                <li>
                    <p class="p1 clearfix">
                <span class="fl">
                    <#if (item.type)??&&(item.type==1)>入会赠送</#if>
                    <#if (item.type)??&&(item.type==2)>商品购买</#if>
                    <#if (item.type)??&&(item.type==3)>合作商消费</#if>
                </span>
                        <span class="fr"><span class="iconfont icon-jinbi"></span>
                    <#if (item.income)??&&(item.income==1)>+</#if>
                    <#if (item.income)??&&(item.income==0)>-</#if>
                  ${(item.num)?c!''}
                </span>
                    </p>
                    <p class="p2 clearfix">
                        <span class="fl">${item.createtime?string("yyyy-MM-dd hh:MM:ss")}</span>
                        <span class="fr">
                </span>
                    </p>
                </li>
            </#list>
        </ul>
        <div class="space"></div>
    </div>
    <input type="hidden" name="pageNum" id="pageNum" value="1"/>
    <input type="hidden" name="pageSize" id="pageSize" value="${pageSize!1}"/>
    <input type="hidden" name="mid" id="mid" value="${mid}"/>
    <input type="hidden" name="totalPage" id="totalPage" value="${totalPage!0}"/>
</form>
<script src="${contextPath}/staticwx/hx/js/jquery-3.0.0.min.js" type="text/javascript"></script>
<script src="${contextPath}/staticwx/hx/js/swiper-3.3.1.jquery.min.js"></script>
<script src="${contextPath}/staticwx/hx/js/fastclick.js" type="text/javascript" ></script>
<script src="${contextPath}/staticwx/hx/js/public.js" type="text/javascript"></script>
<script src="${contextPath}/staticwx/hx/js/count.js" type="text/javascript"></script>
<script src="${contextPath}/staticwx/hx/js/dropload.js"></script>
<script type="text/javascript">
    $(function () {
        var curPage = $("#pageNum").val();
        var totalPage=$("#totalPage").val();
        // dropload
        var dropload = $('.wrapper').dropload({
            scrollArea: $('.wrapper'),
            domDown: {
                domClass: 'dropload-down',
                domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
                domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
                domNoData: '<hr class="dropload-noData"></hr>'
            },
            loadDownFn: function (me) {
                setTimeout(function () {
                    if (curPage==totalPage||totalPage==0) {
                        me.resetload();
                        me.lock();
                        me.noData();
                        me.resetload();
                        return;
                    }
                    curPage++;
                    $("#pageNum").val(curPage);
                    var result = '';
                    $.ajax({
                        url : '${contextPath}/wx/member/myIntegralData.htm',
                        data : $("#searchForm").serialize(),
                        type : 'post',
                        cache : false,
                        dataType : 'json',
                        success : function(data) {
                            var json = $.parseJSON(data);
                            if (json.isSuccess == true) {
                                var recordList=json.page;
                                var newDate = new Date();
                                $.each(recordList,function(i,item){
                                    newDate.setTime(parseInt(item.createtime));
                                    result
                                        +='    <li>'
                                        +' <p class="p1 clearfix">';

                                    if(item.type!=null&&item.type==1){
                                        result +='<span class="fl">入会赠送</span>';
                                    }
                                    if(item.type!=null&&item.type==2){
                                        result +='<span class="fl">商品购买</span>';
                                    }
                                    if(item.type!=null&&item.type==3){
                                        result +='<span class="fl">合作商消费</span>';
                                    }
                                    result += '<span class="fr"><span class="iconfont icon-jinbi"></span> ';
                                    if(item.income!=null&&item.income==1){
                                        result +='+';
                                    }
                                    if(item.income!=null&&item.income==0){
                                        result +='-';
                                    }
                                    result +=' '+item.num+''
                                        +'</span>'
                                        +' </p>'
                                        +'<p class="p2 clearfix">'
                                        +'<span class="fl">'+newDate.format('yyyy-MM-dd hh:mm:ss')+'</span>';
                                    result +='</p>'
                                        +'</li>';
                                });
                                $('.jifenList').append(result);
                                me.resetload();
                            }else{
                                alert(json.errorMessage);
                            }
                        },
                        error : function() {
                            //alert("异常！");
                        }
                    });
                }, 500);
            }
        });

    });

    //日期格式化
    Date.prototype.format = function(format) {
        var date = {
            "M+": this.getMonth() + 1,
            "d+": this.getDate(),
            "h+": this.getHours(),
            "m+": this.getMinutes(),
            "s+": this.getSeconds(),
            "q+": Math.floor((this.getMonth() + 3) / 3)
        };
        if (/(y+)/i.test(format)) {
            format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
        }
        for (var k in date) {
            if (new RegExp("(" + k + ")").test(format)) {
                format = format.replace(RegExp.$1, RegExp.$1.length == 1
                    ? date[k] : ("00" + date[k]).substr(("" + date[k]).length));
            }
        }
        return format;
    }

</script>
</body>
</html>